import axios from "../utils/axios";

/**
 * 创建班级
 * @param {*} name
 * @returns
 */
export const createClass = (name) =>
  axios.post("/class/create", { data: { name } });

/**
 * 获取所有的班级
 */
export const getAllClass = (pageNum, pageSize) => axios.get('class/getAll', {params: {pageNum, pageSize}})

/**
 * 获取一个班级的信息
 * @param {*} id 
 * @returns 
 */
export const getOne = (id) => axios.get('/class/getOne/' + id)

/**
 * 编辑班级信息
 * @param {*} data 
 * @returns 
 */
export const editClass = (data) => axios.put('/class/edit', {data})

/**
 * 删除班级
 * @param {*} classId 
 * @returns 
 */
export const delClass = (classId) => axios.delete('/class/delete', {data: {classId}})


/**
 * 添加班级
 * @param {*} command_word 
 * @returns 
 */
export const addClass = (command_word) => axios.post('/class/add', {data: {command_word}})

/**
 * 获取学生的信息
 * @param {*} id 
 * @returns 
 */
export const getStuClass = () => axios.get('/class/getStuClass/')

/**
 * 退出班级
 * @param {*} id 
 * @returns 
 */
export const exitStuClass = (id) => axios.delete('/class/exitStuClass/' + id)

/**
 * 获取教师信息
 * @returns 
 */
export const getTchInfo = () => axios.get('/class/getTchInfo')